package com.heima.admin.controller.v1;

import com.heima.apis.wemedia.IWemediaClient;
import com.heima.model.admin.dtos.NewsAuthDto;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: Lei
 * 自媒体文章人工审核
 */
@RestController
@RequestMapping("/api/v1/news")
public class NewsController {
    @Autowired
    private IWemediaClient iWemediaClient;

    /**
     * 查询文章列表
     * @param dto
     * @return
     */
    @PostMapping("/list_vo")
    public PageResponseResult listVO(@RequestBody NewsAuthDto dto) {
        return iWemediaClient.listVO(dto);
    }

    /**
     * 查询文章详情
     * @param id
     * @return
     */
    @GetMapping("/one_vo/{id}")
    public ResponseResult getOneVO(@PathVariable Integer id) {
        return iWemediaClient.getOneVO(id);
    }

    /**
     * 审核通过
     * @param dto
     * @return
     */
    @PostMapping("/auth_fail")
    public ResponseResult authFail(@RequestBody NewsAuthDto dto){
        return iWemediaClient.authFail(dto);
    }

    /**
     * 审核失败
     * @param dto
     * @return
     */
    @PostMapping("/auth_pass")
    public ResponseResult authPass(@RequestBody NewsAuthDto dto){
        return iWemediaClient.authPass(dto);
    }
}
